package com.test.app.login;

import android.app.Activity;
import android.os.Bundle;

import com.test.app.componentbase.service.IAccountService;

import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentTransaction;

public class AccountService implements IAccountService {

    private String id;

    @Override
    public void login(String id) {
        this.id = id;
    }

    @Override
    public String getAccountId() {
        return id;
    }

    @Override
    public Fragment newUserFragment(Activity activity, int containerId, FragmentManager manager, Bundle bundle, String tag) {
        FragmentTransaction transaction = manager.beginTransaction();
        Fragment userFragment = new UserFragment();
        transaction.add(containerId, userFragment, tag);
        transaction.commit();
        return userFragment;
    }
}
